using DevExpress.Utils;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using System.Collections.Generic;

namespace Comteck.Winforms.Infrastructure {
  /// <summary>
  /// 下拉框绑定类的参数
  /// </summary>
  public class BindHelperOption {
    /// <summary>
    /// 显示 字段名
    /// </summary>
    public string DisplayMember { get; set; }

    /// <summary>
    /// 值 字段名
    /// </summary>
    public string ValueMember { get; set; }

    /// <summary>
    /// 选中的值
    /// </summary>
    public object EditValue { get; set; }

    ///// <summary>
    ///// 是否允许添加默认选项
    ///// </summary>
    //public bool AllowEmptyItem { get; set; } = false;

    /// <summary>
    /// 默认文本
    /// </summary>
    public string NullValuePrompt { get; set; } = "";

    /// <summary>
    /// 树形结构 节点字段
    /// </summary>
    public string KeyFieldName { get; set; }

    /// <summary>
    /// 树形结构 父节点字段
    /// </summary>
    public string ParentFieldName { get; set; }

    /// <summary>
    /// 绑定列的选项
    /// </summary>
    public List<BindColumnOption> BindColumnOptions { get; set; }

    /// <summary>
    /// 是否异步绑定
    /// </summary>
    public bool IsAsync { get; set; } = true;
    /// <summary>
    /// 编辑模式
    /// </summary>
    public TextEditStyles TextEditStyle { get; set; } = TextEditStyles.Standard;
  }

  /// <summary>
  /// 字段的选项
  /// </summary>
  public class BindColumnOption {
    /// <summary>
    /// 字段名
    /// </summary>
    public string FieldName { get; set; }

    /// <summary>
    /// 长度
    /// </summary>
    public int Width { get; set; } = 80;

    /// <summary>
    /// 显示标题
    /// </summary>
    public string Caption { get; set; }

    /// <summary>
    /// 是否可见
    /// </summary>
    public virtual bool Visible { get; set; } = true;

    /// <summary>
    /// 格式化类型
    /// </summary>
    public FormatType FormatType { get; set; }

    /// <summary>
    /// 格式化字符
    /// </summary>
    public string FormatString { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public RepositoryItem ColumnEdit { get; set; }
  }
}
